package com.stray.crawl.exec;

import java.lang.reflect.Field;

import com.stray.crawl.model.PlanField;
import com.stray.crawl.utils.ModelUtils;

public class CodeGenerationTool {
	
	public static void main(String[] args) {
		Class<?> clazz = PlanField.class;
		
		Field[] fields = clazz.getDeclaredFields();
		
		System.out.println("----- Class -----\r\n");
		for (Field field : fields) {
			String f = field.getName();
			String c = ModelUtils.convertFieldToColumn(f);
			
			if (f.equals("id")) {
				System.out.println("	@Id");
				System.out.println("	@GeneratedValue(strategy = GenerationType.AUTO)");
				System.out.println("	private long id;");
			} else {
				System.out.println("	@Column(name = \"" + c + "\")");
				System.out.println("	private " + field.getType().getSimpleName() + " " + f + ";");
			}
			
			System.out.println();
		}
		
		System.out.println("----- Tmp -----\r\n");
		for (Field field : fields) {
			String f = field.getName();
			String c = ModelUtils.convertFieldToColumn(f);
			
			System.out.println("	String " + c.toUpperCase() + " = \"plan." + c + "\";");
		}
	}

}
